package com.mingqijia.gassafety.authority.api.req.resource;

import com.mingqijia.gassafety.shared.constant.Constants;
import com.mingqijia.gassafety.shared.cqrs.AuthoritySupportReq;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.Max;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.io.Serializable;

/**
 * 更新权限资源请求参数
 * @author Damon S.
 * @version v1.0.1
 * @date {YEAR}年{MONTH}月{DAY}日 {TIME}
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "更新菜单请求")
public final class UpdateMenuResourceReqDTO extends AuthoritySupportReq implements Serializable {

    @NotNull(message = "资源ID不能为空")
    @ApiModelProperty(value = "资源编号", required = true)
    private String resId;

    @ApiModelProperty(value = "资源名称", required = true)
    @Pattern(regexp = "^[^\\s]{1,50}$", message = "名称应满足1-50位汉字、字母、数字、符号")
    private String name;

    @ApiModelProperty(value = "父级资源(菜单)")
    private String parentId;

    @ApiModelProperty(value = "资源(菜单)图标")
    private String icon;

    @ApiModelProperty(value = "访问路径")
    @Pattern(regexp = Constants.REGEXP_URL, message = "请输入2000之内的字符")
    private String url;

    @ApiModelProperty(value = "排序值", required = true)
    @Max(value = 100, message = "请输入0到100之间的数字")
    private Integer ordinal;
}
